package com.weixing.mall.provider.model.vo;

import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.weixing.mall.base.constant.DatePattern;
import com.weixing.mall.base.constant.GlobalConstant;
import com.weixing.mall.base.enums.WhetherEnum;
import com.weixing.mall.core.enums.OrderAppTagEnum;
import com.weixing.mall.core.enums.OrderSysTagEnum;
import com.weixing.mall.provider.api.model.enums.OrderTypeEnum;
import com.weixing.mall.provider.api.model.enums.SettleStateEnum;
import com.weixing.mall.provider.model.enums.*;
import com.weixing.mall.provider.support.excel.EnumConverter.IsRepeatConverter;
import com.weixing.mall.provider.support.excel.EnumConverter.OrderIsClaimConverter;
import com.weixing.mall.provider.support.excel.EnumConverter.OrderSysTagConverter;
import com.weixing.mall.provider.support.excel.EnumConverter.WhetherEnumConverter;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;

/**
 * 客服审核订单列表vo
 *
 * @author  wx
 * @since  v1.0
 */
@Data
public class KefuAuditOrderVo {

    @ApiModelProperty(value = "商品图片")
    @ExcelIgnore
    private String productImg;
    @ExcelProperty("商品图片")
    @ColumnWidth(10)
    private URL goodsImgUrl;

    public void setProductImg(String productImg) {
        this.productImg = productImg;
        try {
            if (StrUtil.isNotEmpty(productImg)){
                this.goodsImgUrl=new URL(GlobalConstant.IMG_PATH_URL+productImg+GlobalConstant.IMG_PATH_URL_SUFFIX);
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }

    @ApiModelProperty(value = "货号")
    @ExcelProperty("货号")
    private String goodsSn;

    @ApiModelProperty(value = "款号")
    @ExcelProperty("款号")
    private String styleNo;

    @ApiModelProperty(value = "颜色")
    @ExcelProperty("颜色")
    private String color;

    @ApiModelProperty(value = "尺码")
    @ExcelProperty("尺码")
    private String size;

    @ApiModelProperty(value = "支付流水号")
    @ExcelProperty("支付流水号")
    private String outTradeNo;

    @ApiModelProperty(value = "订单号")
    @ExcelProperty("订单号")
    private String orderSn;

    @ApiModelProperty(value = "吊牌价")
    @ExcelProperty("吊牌价")
    private BigDecimal marketPrice;

    @ApiModelProperty(value = "订单金额")
    @ExcelProperty("订单金额")
    private BigDecimal orderPrice;

    @ApiModelProperty(value = "收货人信息")
    @ExcelProperty("收货人信息")
    private String contactUser;

    @ApiModelProperty(value = "收货人手机号")
    @ExcelProperty("收货人手机号")
    private String contactPhone;

    @ApiModelProperty(value = "收获地址")
    @ExcelProperty("收获地址")
    private String addrDetails;

    @ApiModelProperty(value = "是否支付")
    @ExcelProperty(value="是否支付", converter = WhetherEnumConverter.class)
    private WhetherEnum isPay;

    @ApiModelProperty(value = "标签状态")
    @ExcelProperty(value = "标签状态", converter = OrderSysTagConverter.class)
    private OrderSysTagEnum sysTag;

    @ApiModelProperty(value = "认领状态")
    @ExcelProperty(value = "认领状态", converter = OrderIsClaimConverter.class)
    private OrderIsClaimEnum isClaim;

    @ApiModelProperty(value = "是否换货")
    @ExcelProperty(value = "是否换货", converter = IsRepeatConverter.class)
    private Integer afterSaleTag;

    @ApiModelProperty(value = "商品名称")
    @ExcelProperty("商品名称")
    private String goodsName;

    @ApiModelProperty(value = "活动名称")
    @ExcelProperty("活动名称")
    private String actName;

    @ApiModelProperty(value = "下单人")
    @ExcelProperty("下单人")
    private String buyer;

    @ApiModelProperty(value = "四级代理")
    @ExcelIgnore
    @ExcelProperty("四级代理")
    private String level4thName;

    @ApiModelProperty(value = "三级代理")
    @ExcelProperty("三级代理")
    private String level3rdName;

    @ApiModelProperty(value = "二级代理")
    @ExcelProperty("二级代理")
    private String level2ndName;

    @ApiModelProperty(value = "一级代理")
    @ExcelProperty("一级代理")
    private String level1stName;

    @ApiModelProperty(value = "经销商")
    @ExcelProperty("经销商")
    private String distributorName;

    @ApiModelProperty(value = "客服")
    @ExcelProperty("客服")
    private String customerName;

    @ApiModelProperty(value = "发货员")
    @ExcelProperty("发货员")
    private String shipperName;

    @ApiModelProperty(value = "快递公司")
    @ExcelProperty("快递公司")
    private String expressName;

    @ApiModelProperty(value = "快递单号")
    @ExcelProperty("快递单号")
    private String expressSn;

    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "下单时间")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("下单时间")
    private Date createdTime;

    @ApiModelProperty(value = "客服审核时间")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("客服审核时间")
    private Date auditTime;

    @ApiModelProperty(value = "发货时间")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("发货时间")
    private Date shipTime;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("更新时间")
    private Date updatedTime;



    @ExcelProperty("序号")
    private String xu;
    /**
     * 订单id
     */
    @ExcelIgnore
    private Long id;



    /**
     * 订单最后操作时间
     */
    @ExcelIgnore
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    private Date updateTime;
    /**
     * 订单状态
     */
    @ExcelIgnore
    private OrderStateEnum orderStatus;
    /**
     * 订单来源
     */
    @ExcelIgnore
    private OrderFromEnum orderFrom;

    /**
     * 代理商
     */
    @ExcelIgnore
    private String agentName;
    /**
     * 商品id
     */
    @ExcelIgnore
    private Long goodsId;
    /**
     * 货品码
     */
    @ExcelIgnore
    private String productSn;
    /**
     * sku
     */
    @ExcelIgnore
    private String productSkuDesp;
    /**
     * 是否是代理认领订单
     */
    @ExcelIgnore
    private WhetherEnum isCliam;
    /**
     * 是否已结算
     */
    @ExcelIgnore
    private OrderIsSettleEnum isSettle;
    @ExcelIgnore
    private SettleStateEnum settleState;

    /**
     * 订单类型
     */
    @ExcelIgnore
    private OrderTypeEnum orderType;

    /**
     * 审核状态
     */
    @ExcelIgnore
    private OrderAuditStateEnum auditStatus;

    /**
     * 所属客服id
     */
    @ExcelIgnore
    private Long customerId;


    /**
     * 最后操作时间
     */
    @ExcelIgnore
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    private Date operationTime;
    /**
     * 需审核部门
     */
    @ExcelIgnore
    private AuditDeptEnum auditDept;
    /**
     * 需审核人
     */
    @ExcelIgnore
    private String auditor;

    /**
     * 需审核人id
     */
    @ExcelIgnore
    private Long auditorId;
    /**
     * 待审核人
     */
    @ExcelIgnore
    private String unAuditor;

    /**
     * 已审核人
     */
    @ExcelIgnore
    private String auditedName;
    /**
     * 代理商时间轴
     */
    @ExcelIgnore
    @JsonIgnore
    private String agentCliamLine;
    /**
     * 需上交代理商名称
     */
    @ExcelIgnore
    private String payAgentName;
    /**
     * 需收款
     */
    @ExcelIgnore
    private BigDecimal payPrice = BigDecimal.ZERO;

    /**
     * 需上交款
     */
    @ExcelIgnore
    private BigDecimal payUpPrice = BigDecimal.ZERO;

    /**
     * 发货员取消时间
     */
    @ExcelIgnore
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    private Date canceledTime;

    /**
     * 发货员取消时间
     */
    @ExcelIgnore
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = DatePattern.NORM_DATETIME_PATTERN)
    private String calcelTime;

    /**
     * 取消审核状态
     */
    @ExcelIgnore
    private NoSuppllyAuditEnum nosuppllyAudit;


    /**
     * 是否可删除
     */
    @ExcelIgnore
    private Integer canDel = 0;

    /**
     * 系统标签
     */
    @ExcelIgnore
    private String orderSysTag;


    /**
     * 是否已绑定代理
     */
    @ExcelIgnore
    private WhetherEnum isBind;

    /**
     * 是否线上订单
     */
    @ExcelIgnore
    private WhetherEnum isOnline ;

    /**
     * 代理已审核列表
     */
    @ExcelIgnore
    @JsonIgnore
    private String orderAuditorList;

    /**
     * 代理商标签
     */
    @ExcelIgnore
    private OrderAppTagEnum appTag;


    /**
     * 省
     */
    @ExcelIgnore
    private String province;
    /**
     * 市
     */
    @ExcelIgnore
    private String city;
    /**
     * 区
     */
    @ExcelIgnore
    private String region;
    /**
     * 详细地址
     */
    @ExcelIgnore
    private String addrDetail;


    /**
     * 支付渠道
     */
    @ExcelIgnore
    private Integer payChannel;

    /**
     * 代理商id
     */
    @ExcelIgnore
    private Long agentId;

    @ExcelProperty("身高")
    private String height;
    /*序号二期新增体重属性*/
    @ExcelProperty("体重")
    private String weight;

    /*序号二期新增仓库编码属性*/
    @ExcelProperty("仓库编码")
    private String depotSn;

    @ExcelIgnore
    private String stockSn;


}
